package com.api.shopapi.service.impl;

import com.api.shopapi.entity.Error;
import com.api.shopapi.mapper.ErrorMapper;
import com.api.shopapi.service.ErrorService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("ErrorServiceImplOne")
public class ErrorServiceImpl implements ErrorService {

    @Autowired
    private ErrorMapper errorMapper;

    @Override
    public int insert(Error error){
        return errorMapper.insert(error);
    }

    @Override
    public List<Error> getList(){
        return errorMapper.getList();
    }

    @Override
    public PageInfo<Error> getPageList(int pageIndex, int pageSize){
        PageHelper.startPage(pageIndex,pageSize);
        List<Error> errorList= errorMapper.getList();
        return new PageInfo<>(errorList);
    }

}
